<template>
	<div id="app">
		<mt-header fixed title="房天下,提供最全，最新的二手房、租房、新楼盘信息"></mt-header>
		<div v-if="isshow" id="back">
			<a href="javascript:void(0)" @click="backto">返回</a>
		</div>
		<router-view/>
	</div>
</template>

<script>
	export default {
		name: 'app',
		data() {
			return {
				isshow: false
			}
		},
		methods: {
			backto() {
				//利用路由对象中的go(-1)来实现返回到上一级页面(这个方法是vue-router的方法)
				this.$router.go(-1);
			}
		},
		watch: {
			/* '$route'(old,news){ 
				console.log(old)
				console.log(news)
			}*/

			'$route': function(newroute, oldroute) {
				console.log(newroute)
				console.log(oldroute)
				if(newroute.path.toLowerCase() == '/home') {
					this.isshow = false;
				} else {
					this.isshow = true;
				}
			}
		}
	}
</script>

<style scoped>
	body {
		background: #FFFFFF;
	}
	
	#app {
		font-family: '微软雅黑';
		-webkit-font-smoothing: antialiased;
		-moz-osx-font-smoothing: grayscale;
	}
	
	#back {
		width: 60px;
		position: absolute;
		top: 10px;
		left: 10px;
		z-index: 101;
	}
	
	#back a {
		color: #fff;
	}
</style>